﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using Facade;
using IronOne.SalesOne.BusinessObjects;

namespace IronOne.SalesOne.SalesOneWeb.ProductLibrary
{
    public partial class ManageProducts : System.Web.UI.Page
    {


        List<Product> products;
        ProductFacade productFacade = new ProductFacade();
        


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {

            productFacade = new ProductFacade();
            //int[] hideColumn = { 1 };
            int[] hideColumn = { 0 , 1 , 2  };

            String productCategory = ddlPlanCategory.SelectedValue;



            switch (productCategory)
            {
                case "Life Plan":
                    products = productFacade.GetProducts("CodeId ASC");
                    
                    UCGrid1.SetDataSource(products, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;
                case "Retirement Plan":
                    products = productFacade.GetProducts("CodeId ASC");

                    UCGrid1.SetDataSource(products, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "Unit Linked Plan":
                    products = productFacade.GetProducts("CodeId ASC");
                    UCGrid1.SetDataSource(products, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;
               
                //case "Select...":
                //    Response.Redirect("~/UserManagement/CodeType.aspx", false);
                //    //Server.Transfer("~/UserManagement/CodeType.aspx");
                //    break;

                default:
                    break;

            }

        }
    }
}
